import {useRoutes,Navigate} from 'react-router-dom'
import Home from '../views/Home'
import Music from '../views/Music'
import News from '../views/News'
import Hot from '../views/Hot'
import Detail from '../views/Detail'
import Coppern from '../views/Coppern'
import ErrorPage from '../views/ErrorPage'
import City from '../views/City'
import Musicjpg from '../views/Musicjpg'
import Musgd from '../views/Musgd'
import Musdetail from '../views/Musdetail'
const RouterViews =()=>{
    const routes =useRoutes([{
        path:"/",
        element:<Home/>
    },
    
        {
        path:"/city",
        element:<City/>
        },
        {
        path:"/musicjpg",
        element:<Musicjpg/>
        },
        {
            path:"/musgd",
            element:<Musgd/>
        },
        {
            path:"/musdetail/:id",
            element:<Musdetail/>
        },
        {
        path:"/music",
        element:<Music/>,
        children:[
            {
                // 默认路由重定向
                path:"/music",
                element:<Navigate to="/music/news"/>
            },
            {
                // 默认路由
                path:"news",
                element:<News/>
            },
            {
                path:"hot",
                element:<Hot/>
            },{
                path:"*",
                element:<ErrorPage/>
            },{
                path:"detail/:id",
                element:<Detail/>
            },{
                path:"coppern/:id",
                element:<Coppern/>
            }
        ]
    }
])
    return routes
}
export default RouterViews